package org.hertsig.magiccardmarket.entities;

import java.util.Date;
import java.util.List;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import lombok.AllArgsConstructor;
import lombok.Delegate;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;

import org.hertsig.magiccardmarket.entities.Articles.Article;

@Getter @ToString
@AllArgsConstructor @NoArgsConstructor
@XmlRootElement(name="response")
public class Orders implements Iterable<Orders.Order> {
	@Delegate(types=Iterable.class) @XmlElement private List<Order> order;
	
	@Getter @ToString
	@AllArgsConstructor @NoArgsConstructor
	public static class Order {
		@XmlElement private String idOrder;
		@XmlElement private Actor seller;
		@XmlElement private Actor buyer;
		@XmlElement private OrderStatus state;
		@XmlElement private ShippingMethod shippingMethod;
		@XmlElement private Evaluation evaluation;
		@XmlElement private List<Article> article;
		@XmlElement private Double articleValue;
		@XmlElement private Double totalValue;
	}
	
	@Getter @ToString
	@AllArgsConstructor @NoArgsConstructor
	public static class Name {
		@XmlElement private String firstName;
		@XmlElement private String lastName;
	}
	
	@Getter @ToString
	@AllArgsConstructor @NoArgsConstructor
	public static class Address {
		@XmlElement private String name;
		@XmlElement private String extra;
		@XmlElement private String street;
		@XmlElement private String zip;
		@XmlElement private String city;
		@XmlElement private String country;
	}
	
	@Getter @ToString
	@AllArgsConstructor @NoArgsConstructor
	public static class OrderStatus {
		@XmlElement private String state;
		@XmlElement private Date dateBought;
		@XmlElement private Date datePaid;
		@XmlElement private Date dateSent;
		@XmlElement private Date dateReceived;
		@XmlElement private Date dateCancelled;
	}
	
	@Getter @ToString
	@AllArgsConstructor @NoArgsConstructor
	public static class ShippingMethod {
		@XmlElement private String name;
		@XmlElement private Double price;
	}
	
	@Getter @ToString
	@AllArgsConstructor @NoArgsConstructor
	public static class Evaluation {
		@XmlElement private String overall;
		@XmlElement private String articles;
		@XmlElement private String packaging;
		@XmlElement private String speed;
		@XmlElement private String comments;
	}
}
